function compareValue(thisYearValue,lastYearValue){	
	var ty=thisYearValue;
	var ly=lastYearValue;
	if(ty==undefined){
		return '';
	}
	if (ty==undefined||ly==null||ly==0) {
		return ' ';
	} else if(((ly-ty)*100/ly).toFixed(2)==0.00){
		return ' <span  style="float:right;color:orange;font-size:5px;text-align:left;"><i class="glyphicon glyphicon-minus"></i>0.00%</span>';
	} else if (ty>ly&&ly!=0) {
		return ' <span style="float:right;color:red;font-size:5px;text-align:left;"><i class="glyphicon glyphicon-arrow-up"></i>'+((ty-ly)*100/ly).toFixed(2)+'%</span>';
	} else if(ty<ly){
		if(ty==0){
			return ' ';
		}
		return ' <span style="float:right;color:green;font-size:5px;text-align:left;"><i class="glyphicon glyphicon-arrow-down"></i>'+((ly-ty)*100/ly).toFixed(2)+'%</span>';
	}
}
function compareValueAvgDays(thisYearValue,lastYearValue){	
	var ty=thisYearValue;
	var ly=lastYearValue;
	if(ty==undefined){
		return '';
	}
	if (ty==undefined||ly==null||ly==0) {
		return ' ';
	} else if((ly-ty).toFixed(2)==0.00){
		return ' <span  style="float:right;color:orange;font-size:5px;text-align:left;"><i class="glyphicon glyphicon-minus"></i>0.00</span>';
	} else if (ty>ly&&ly!=0) {
		return ' <span style="float:right;color:red;font-size:5px;text-align:left;"><i class="glyphicon glyphicon-arrow-up"></i>'+(ty-ly).toFixed(2)+'</span>';
	} else if(ty<ly){
		if(ty==0){
			return ' ';
		}
		return ' <span style="float:right;color:green;font-size:5px;text-align:left;"><i class="glyphicon glyphicon-arrow-down"></i>'+(ly-ty).toFixed(2)+'</span>';
	}
}
//清空全院数据
function emptyquotaCompare(quotaCode){
	$("#"+tabId+" #hosp"+quotaCode+" tr:eq(1)").find("td").eq(1).html('<span style=" "><i class="glyphicon glyphicon-minus"></i><i class="glyphicon glyphicon-minus"></i></span>');
	$("#"+tabId+" #hosp"+quotaCode+" tr:eq(1)").find("td").eq(0).html('<span style=" "><i class="glyphicon glyphicon-minus"></i><i class="glyphicon glyphicon-minus"></i></span>');
	$("#"+tabId+" #hosp"+quotaCode+" tr:eq(2)").find("td").eq(0).html('<span style=" "><i class="glyphicon glyphicon-minus"></i><i class="glyphicon glyphicon-minus"></i></span>');
}

//清空其他表格数据
function emptyResultOtherTable(quotaCode){
	//重新加载一个新的空表格
	$("#"+tabId+" #result"+quotaCode+"-table ").dataTable({
		"bDestroy": true, //覆盖加载
		"bPaginate": false, //翻页功能
 		"bLengthChange": false, //改变每页显示数据数量
 		"bFilter": false, //过滤功能
 		"bInfo": false, //页脚信息
	   // "aaData": data,
	    "bStateSave": true, //保存状态信息
	    "aSort":false, //排序
	    "aaSorting": [
	                  [ 6, "desc" ]
	                 ], 
	    "aoColumns": [ 
	                     { "data": 'drgCode1', 
	                       "render": function(){                    	  
	                    	   return " ";
	                       }
	                     },
	                     { "data": "avgDays1",
	                    	 "render": function(){
	                    		 return " ";  
		                       }
	                     },
 	                     { "data": "avgFee1",
	                    	 "render": function(){
	                    		 return " ";  		             
	                    	 }
	                     },
 	                     { "data": 'hcAvgFee1',
	                    	 "render": function(){		                    	  
	                    		 return " ";
		                       }
	                     },
 	                     { "data": "drugFee1",
	                    	 "render": function(){
	                    		 return " ";
		                       }
	                     },
 	                     { "data": "hcDrugFee1",
	                    	 "render": function(){		                    	  
	                    		 return " ";
		                       }
	                     },
 	                     { "data": 'totalCaseCnt1', "sType": "numeric-input",
	                    	 "render": function(){
	                    		 return " ";
		                       }
	                     },
 	                     { "data": "hcCaseCnt1",
	                    	 "render": function(){		                     
	                    		 return " ";
		                       }
	                     },
 	                     { "data": "notHCRatio",
	                    	 "render": function(){		                    	  
	                    		 return " ";
		                       }
	                     },
 	                     { "data": "hcTotalFund",
	                    	 "render": function(){		                    	  
		                    	   return " ";
		                       }
	                     },
	                     { "data": "timeEff1",
	                    	 "render": function(){		                    	  
	                    		 return " ";
		                       }
	                     },
	                     { "data": "feeEff1",
	                    	 "render": function(){		                    	  
	                    		 return "";
		                       }
	                     },
	                     { "data": "drugMateFee1",
	                    	 "render": function(){
	                    		 return " ";
		                       }
	                     },
 	                     { "data": "hcDrugMateFee1",
	                    	 "render": function(){		                    	  
	                    		 return " ";
		                       }
	                     }
	                 ]
		});
	//$("#"+tabId+" #result"+quotaCode+"-table  tr:not(:first)").empty();
	//清除出表头以及第二行以外的其他数据
	$("#"+tabId+" #result"+quotaCode+"-table tbody tr").eq(0).nextAll().remove();
}



function quotaCompare(quotaCode, data){
	var value = data[quotaCode];
	var valuely = $("#"+tabId+" #hosp"+quotaCode+" tr:eq(3)").find("td").eq(0).html();
	$("#"+tabId+" #hosp"+quotaCode+" tr:eq(1)").find("td").eq(0).html(value);
	if(quotaCode=="AvgDays"){
		percent =isNaN(Math.abs(parseFloat(value)-parseFloat(valuely)).toFixed(1))?"--":(Math.abs(parseFloat(value)-parseFloat(valuely)).toFixed(2));//当后台返回值为NaN时在页面上显示为--
		$("#"+tabId+" #hosp"+quotaCode+" tr:eq(2)").find("td").eq(0).html(percent);
	}else{
		var percent = "--";
		if(parseFloat(valuely)>0){
			percent = Math.abs((parseFloat(value)-parseFloat(valuely))/parseFloat(valuely)*100).toFixed(2);
			percent = parseFloat(percent);
			percent =isNaN(percent)?"--":percent+"%";//当percent为NaN时，默认显示为--
		}
		$("#"+tabId+" #hosp"+quotaCode+" tr:eq(2)").find("td").eq(0).html(percent);
	}
	if(parseFloat(value)>parseFloat(valuely)){
		$("#"+tabId+" #hosp"+quotaCode+" tr:eq(1)").find("td").eq(1).html('<span style="color:red;font-size:8px;"><i class="glyphicon glyphicon-arrow-up"></i>');
	}else if(parseFloat(value)<parseFloat(valuely)){
		$("#"+tabId+" #hosp"+quotaCode+" tr:eq(1)").find("td").eq(1).html('<span style="color:green;font-size:8px;"><i class="glyphicon glyphicon-arrow-down"></i>');
	}else{
		$("#"+tabId+" #hosp"+quotaCode+" tr:eq(1)").find("td").eq(1).html('<span style="color:orange;font-size:8px;"><i class="glyphicon glyphicon-minus"></i>');
	}
}

function loadResultTableDrgs(data){
	$("#"+tabId+" #resultDRGs-table").dataTable({
		"bDestroy": true, //覆盖加载
		"bPaginate": false, //翻页功能
 		"bLengthChange": false, //改变每页显示数据数量
 		"bFilter": false, //过滤功能
 		"bInfo": true, //页脚信息
	    "aaData": data,
	    "bStateSave": true, //保存状态信息
	    "aSort":false, //排序
	    "aaSorting": [
	                  [ 6, "desc" ]
	                 ], 
	    "aoColumns": [ 
	                     { "data": 'drgCode1', "sWidth": "16%",
	                       "render": function(obj){
	                    	   var drgDesc = obj.aData.drgDesc;
	                    	   drgDesc = drgDesc.substring(0, 5) + "..."
	                    	   return "<span title='"+obj.aData.drgDesc+"'>"+obj.aData.drgCode+"("+drgDesc+")</span>"
	                       }
	                     },
	                     { "data": "avgDays1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.drgCode+"_AvgDays' type='text' style='width:50px' value='"+obj.aData.avgDays+"'></input>";
	                       }
	                     },
 	                     { "data": "avgFee1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.drgCode+"_AvgFee' type='text' style='width:80px' value='"+obj.aData.avgFee+"'></input>";
	                       }
	                     },
 	                     { "data": 'hcAvgFee1',
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.drgCode+"_HCAvgFee' type='text' style='width:80px' value='"+obj.aData.hcAvgFee+"'></input>";
	                       }
	                     },
 	                     { "data": "drugFee1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.drgCode+"_DrugFee' type='text' style='width:80px' value='"+obj.aData.drugFee+"'></input>";
	                       }
	                     },
 	                     { "data": "hcDrugFee1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.drgCode+"_HCDrugFee' type='text' style='width:80px' value='"+obj.aData.hcDrugFee+"'></input>";
	                       }
	                     },
 	                     { "data": 'totalCaseCnt1', "sType": "numeric-input",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.drgCode+"_TotalCaseCnt' type='text' style='width:50px' value='"+obj.aData.totalCaseCnt+"'></input>";
	                       }
	                     },
 	                     { "data": "hcCaseCnt1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.drgCode+"_HCCaseCnt' type='text' style='width:50px' value='"+obj.aData.hcCaseCnt+"'></input>";
	                       }
	                     },
 	                     { "data": "notHCRatio",
	                       "render": function(obj){
	                    	   if(obj.aData.totalCaseCnt==0){
		                    	   return "<input id='"+obj.aData.adrgCode+"_notHCRatio' type='text' style='width:50px' value='0'></input>";
	                    	   }else{
	                    		   var notHCRatio = (parseFloat(obj.aData.totalCaseCnt)-parseFloat(obj.aData.hcCaseCnt))/parseFloat(obj.aData.totalCaseCnt)*100;
		                    	   return "<input id='"+obj.aData.adrgCode+"_notHCRatio' type='text' style='width:50px' value='"+notHCRatio.toFixed(1)+"'></input>";  
	                    	   }
	                       }
	                     },
 	                     { "data": "hcTotalFund",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.drgCode+"_HCTotalFund' type='text' style='width:80px' value='"+obj.aData.hcTotalFund+"'></input>";
	                       }
	                     },
	                     { "data": "timeEff1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.drgCode+"_TimeEff' type='text' style='width:80px' value='"+obj.aData.timeEff+"'></input>";
	                       }
	                     },
	                     { "data": "feeEff1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.drgCode+"_FeeEff' type='text' style='width:80px' value='"+obj.aData.feeEff+"'></input>";
	                       }
	                     },
	                     { "data": "drugMateFee1",
		                       "render": function(obj){
		                    	   return "<input id='"+obj.aData.drgCode+"_DrugMateFee' type='text' style='width:80px' value='"+obj.aData.drugMateFee+"'></input>";
		                       }
		                     },
	 	                     { "data": "hcDrugMateFee1",
		                       "render": function(obj){
		                    	   return "<input id='"+obj.aData.drgCode+"_HCDrugMateFee' type='text' style='width:80px' value='"+obj.aData.hcDrugMateFee+"'></input>";
		                       }
		                     }
	                 ],
         "oLanguage":{
        	 "sLengthMenu": "每页显示 _MENU_ 条记录",
	    	 "sZeroRecords":"对不起，查询不到任何相关数据",
	    	 "sInfo":"当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",
	    	 "sInfoEmpty":"记录数为0",
	    	 "oPaginate":{"sNext":"下一页","sPrevious":"上一页","sFirst":"首页","sLast":"末页"}
	    	}
		});
}

function loadResultTableAdrg(data){
	$("#"+tabId+" #resultADRG-table").dataTable({
		"bDestroy": true, //覆盖加载
		"bPaginate": false, //翻页功能
 		"bLengthChange": false, //改变每页显示数据数量
 		"bFilter": false, //过滤功能
 		"bInfo": true, //页脚信息
	    "aaData": data,
	    "bStateSave": true, //保存状态信息
	    "aSort":false, //排序
	    "aaSorting": [
	                  [ 6, "desc" ]
	                 ], 
	    "aoColumns": [ 
	                     { "data": 'adrgCode'},
	                     { "data": "avgDays1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.adrgCode+"_AvgDays' type='text' style='width:50px' value='"+obj.aData.avgDays+"'></input>";
	                       }
	                     },
 	                     { "data": "avgFee1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.adrgCode+"_AvgFee' type='text' style='width:80px' value='"+obj.aData.avgFee+"'></input>";
	                       }
	                     },
 	                     { "data": 'hcAvgFee1',
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.adrgCode+"_HCAvgFee' type='text' style='width:80px' value='"+obj.aData.hcAvgFee+"'></input>";
	                       }
	                     },
 	                     { "data": "drugFee1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.adrgCode+"_DrugFee' type='text' style='width:80px' value='"+obj.aData.drugFee+"'></input>";
	                       }
	                     },
 	                     { "data": "hcDrugFee1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.adrgCode+"_HCDrugFee' type='text' style='width:80px' value='"+obj.aData.hcDrugFee+"'></input>";
	                       }
	                     },
 	                     { "data": 'totalCaseCnt1', "sType": "numeric-input",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.adrgCode+"_TotalCaseCnt' type='text' style='width:50px' value='"+obj.aData.totalCaseCnt+"'></input>";
	                       }
	                     },
 	                     { "data": "hcCaseCnt1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.adrgCode+"_HCCaseCnt' type='text' style='width:50px' value='"+obj.aData.hcCaseCnt+"'></input>";
	                       }
	                     },
 	                     { "data": "notHCRatio",
	                       "render": function(obj){
	                    	   if(obj.aData.totalCaseCnt==0){
		                    	   return "<input id='"+obj.aData.adrgCode+"_notHCRatio' type='text' style='width:50px' value='0'></input>";
	                    	   }else{
	                    		   var notHCRatio = (parseFloat(obj.aData.totalCaseCnt)-parseFloat(obj.aData.hcCaseCnt))/parseFloat(obj.aData.totalCaseCnt)*100;
		                    	   return "<input id='"+obj.aData.adrgCode+"_notHCRatio' type='text' style='width:50px' value='"+notHCRatio.toFixed(1)+"'></input>";  
	                    	   }	                    	 
	                       }
	                     },
 	                     { "data": "hcTotalFund",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.adrgCode+"_HCTotalFund' type='text' style='width:80px' value='"+obj.aData.hcTotalFund+"'></input>";
	                       }
	                     },
	                     { "data": "timeEff1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.adrgCode+"_TimeEff' type='text' style='width:80px' value='"+obj.aData.timeEff+"'></input>";
	                       }
	                     },
	                     { "data": "feeEff1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.adrgCode+"_FeeEff' type='text' style='width:80px' value='"+obj.aData.feeEff+"'></input>";
	                       }
	                     },
	                     { "data": "drugMateFee1",
		                       "render": function(obj){
		                    	   return "<input id='"+obj.aData.adrgCode+"_DrugMateFee' type='text' style='width:80px' value='"+obj.aData.drugMateFee+"'></input>";
		                       }
		                     },
	 	                     { "data": "hcDrugMateFee1",
		                       "render": function(obj){
		                    	   return "<input id='"+obj.aData.adrgCode+"_HCDrugMateFee' type='text' style='width:80px' value='"+obj.aData.hcDrugMateFee+"'></input>";
		                       }
		                     }
	                 ],
         "oLanguage":{
        	 "sLengthMenu": "每页显示 _MENU_ 条记录",
	    	 "sZeroRecords":"对不起，查询不到任何相关数据",
	    	 "sInfo":"当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",
	    	 "sInfoEmpty":"记录数为0",
	    	 "oPaginate":{"sNext":"下一页","sPrevious":"上一页","sFirst":"首页","sLast":"末页"}
	    	}
		});
}

function loadResultTableMDC(data){
	$("#"+tabId+" #resultMDC-table").dataTable({
		"bDestroy": true, //覆盖加载
		"bPaginate": false, //翻页功能
 		"bLengthChange": false, //改变每页显示数据数量
 		"bFilter": false, //过滤功能
 		"bInfo": true, //页脚信息
	    "aaData": data,
	    "bStateSave": true, //保存状态信息
	    "aSort":false, //排序
	    "aaSorting": [
	                  [ 6, "desc" ]
	                 ], 
	    "aoColumns": [ 
	                     { "data": 'mdcCode'},
	                     { "data": "avgDays1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.mdcCode+"_AvgDays' type='text' style='width:50px' value='"+obj.aData.avgDays+"'></input>";
	                       }
	                     },
 	                     { "data": "avgFee1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.mdcCode+"_AvgFee' type='text' style='width:80px' value='"+obj.aData.avgFee+"'></input>";
	                       }
	                     },
 	                     { "data": 'hcAvgFee1',
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.mdcCode+"_HCAvgFee' type='text' style='width:80px' value='"+obj.aData.hcAvgFee+"'></input>";
	                       }
	                     },
 	                     { "data": "drugFee1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.mdcCode+"_DrugFee' type='text' style='width:80px' value='"+obj.aData.drugFee+"'></input>";
	                       }
	                     },
 	                     { "data": "hcDrugFee1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.mdcCode+"_HCDrugFee' type='text' style='width:80px' value='"+obj.aData.hcDrugFee+"'></input>";
	                       }
	                     },
 	                     { "data": 'totalCaseCnt1', "sType": "numeric-input",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.mdcCode+"_TotalCaseCnt' type='text' style='width:50px' value='"+obj.aData.totalCaseCnt+"'></input>";
	                       }
	                     },
 	                     { "data": "hcCaseCnt1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.mdcCode+"_HCCaseCnt' type='text' style='width:50px' value='"+obj.aData.hcCaseCnt+"'></input>";
	                       }
	                     },
 	                     { "data": "notHCRatio",
	                       "render": function(obj){	
	                    	   if(obj.aData.totalCaseCnt==0){
		                    	   return "<input id='"+obj.aData.mdcCode+"_notHCRatio' type='text' style='width:50px' value='0'></input>";	                    	   
	                    	   }else{
	                    		   var notHCRatio = (parseFloat(obj.aData.totalCaseCnt)-parseFloat(obj.aData.hcCaseCnt))/parseFloat(obj.aData.totalCaseCnt)*100;
		                    	   return "<input id='"+obj.aData.mdcCode+"_notHCRatio' type='text' style='width:50px' value='"+notHCRatio.toFixed(1)+"'></input>";	                    	
	                    	   }
	                    		  
	                       }
	                     },
 	                     { "data": "hcTotalFund",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.mdcCode+"_HCTotalFund' type='text' style='width:80px' value='"+obj.aData.hcTotalFund+"'></input>";
	                       }
	                     },
	                     { "data": "timeEff1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.mdcCode+"_TimeEff' type='text' style='width:80px' value='"+obj.aData.timeEff+"'></input>";
	                       }
	                     },
	                     { "data": "feeEff1",
	                       "render": function(obj){
	                    	   return "<input id='"+obj.aData.mdcCode+"_FeeEff' type='text' style='width:80px' value='"+obj.aData.feeEff+"'></input>";
	                       }
	                     }
	                 ],
         "oLanguage":{
        	 "sLengthMenu": "每页显示 _MENU_ 条记录",
	    	 "sZeroRecords":"对不起，查询不到任何相关数据",
	    	 "sInfo":"当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",
	    	 "sInfoEmpty":"记录数为0",
	    	 "oPaginate":{"sNext":"下一页","sPrevious":"上一页","sFirst":"首页","sLast":"末页"}
	    	}
		});
}

function loadResultTableDep(data){
	var columns = [{
			"data" : 'depDesc1',
			"title":"科室",
			"render": function(obj, type, full) {
				var depDesc = full.depDesc;
				if (depDesc.length > 5) {
					depDesc = depDesc.substring(0, 5) + "..."
					return "<span title='" + full.depDesc + "'>"
							+ depDesc + "</span>"
				}
				return depDesc;
			}
		},
		{
			"data" : "avgDays1",
			"title":"平均住院日",
			"render": function(obj, type, full) {
				var value = full.avgDays;
				var valuely = full.avgDaysly;
				return "<input id='"
						+ full.depCode
						+ "_AvgDays' type='text' style='width:40px' value='"
						+ full.avgDays + "'></input>"
						+ compareValueAvgDays(value, valuely);
			}
		},
		{
			"data" : "avgFee1",
			"title":"次均费用",
			"render": function(obj, type, full) {
				var value = full.avgFee;
				var valuely = full.avgFeely;
				return "<input id='" + full.depCode
						+ "_AvgFee' type='text' style='width:60px' value='"
						+ full.avgFee + "'></input>"
						+ compareValue(value, valuely);
			}
		},
		{
			"data" : 'hcAvgFee1',
			"title":"医保次均费用",
			"render": function(obj, type, full) {
				var value = full.hcAvgFee;
				var valuely = full.hcAvgFeely;
				return "<input id='"
						+ full.depCode
						+ "_HCAvgFee' type='text' style='width:60px' value='"
						+ full.hcAvgFee + "'></input>"
						+ compareValue(value, valuely);
			}
		},
		{
			"data" : "drugFee1",
			"title":"次均药费",
			"render": function(obj, type, full) {
				return "<input id='"
						+ full.depCode
						+ "_DrugFee' type='text' style='width:80px' value='"
						+ full.drugFee + "'></input>";
			}
		},
		{
			"data" : "hcDrugFee1",
			"title":"医保次均药费",
			"render": function(obj, type, full) {
				return "<input id='"
						+ full.depCode
						+ "_HCDrugFee' type='text' style='width:80px' value='"
						+ full.hcDrugFee + "'></input>";
			}
		},
		{
			"data" : 'totalCaseCnt1',
			"title":"入组病例数",
			"sType" : "numeric-input",
			"render": function(obj, type, full) {
				return "<input id='"
						+ full.depCode
						+ "_TotalCaseCnt' type='text' style='width:50px' value='"
						+ full.totalCaseCnt + "'></input>";
			}
		},
		{
			"data" : "hcCaseCnt1",
			"title":"医保入组病例数",
			"render": function(obj, type, full) {
				return "<input id='"
						+ full.depCode
						+ "_HCCaseCnt' type='text' style='width:50px' value='"
						+ full.hcCaseCnt + "'></input>";
			}
		},
		{
			"data" : "notHCRatio",
			"title":"非医保患者比例（%）",
			"render": function(obj, type, full) {
				if (full.totalCaseCnt == 0) {
					return "<input id='"
							+ full.depCode
							+ "_notHCRatio' type='text' style='width:50px' value='0'></input>";
				} else {
					var notHCRatio = (parseFloat(full.totalCaseCnt) - parseFloat(full.hcCaseCnt))
							/ parseFloat(full.totalCaseCnt) * 100;
					return "<input id='"
							+ full.depCode
							+ "_notHCRatio' type='text' style='width:50px' value='"
							+ notHCRatio.toFixed(1) + "'></input>";
				}
			}
		},
		{
			"data" : "hcTotalFund",
			"title":"医保总基金",
			"render": function(obj, type, full) {
				return "<input id='"
						+ full.depCode
						+ "_HCTotalFund' type='text' style='width:80px' value='"
						+ full.hcTotalFund + "'></input>";
			}
		},
		{
			"data" : "timeEff1",
			"title":"时间消耗指数",
			"render": function(obj, type, full) {
				return "<input id='"
						+ full.depCode
						+ "_TimeEff' type='text' style='width:80px' value='"
						+ full.timeEff + "'></input>";
			}
		},
		{
			"data" : "feeEff1",
			"title":"费用消耗指数",
			"render": function(obj, type, full) {
				return "<input id='" + full.depCode
						+ "_FeeEff' type='text' style='width:80px' value='"
						+ full.feeEff + "'></input>";
			}
		},
		{
			"data" : "drugMateFee1",
			"title":"次均药耗费",
			"render": function(obj, type, full) {
				return "<input id='"
						+ full.depCode
						+ "_DrugMateFee' type='text' style='width:80px' value='"
						+ full.drugMateFee + "'></input>";
			}
		},
		{
			"data" : "hcDrugMateFee1",
			"title":"医保次均药耗费",
			"render": function(obj, type, full) {
				return "<input id='"
						+ full.depCode
						+ "_HCDrugMateFee' type='text' style='width:80px' value='"
						+ full.hcDrugMateFee + "'></input>";
			}
		} ];
		var paramDatatable = {
				lengthChange:false, 
				info:false, 
				searching:false,
				order:[[ 6, "desc" ]],
				paging:false,
				autoWidth : false,
				orderCellsTop : true,
				scrollX:true,
				scrollY:320
				};
		if(qouta_roles!="医保"){
			paramDatatable.columnDefs=[{
				 "visible": false,
				 "targets": [3,5,7,8,9,13]
		    }]
		}
		$("#"+tabId+" #resultDep-table").dataTableBasic(columns, data, paramDatatable);
}

function loadResultTableDepGroup(data){
	var columns = [
			{
				"data" : 'depGroupDesc',
				"title":"科室组"
			},
			{
				"data" : "avgDays1",
				"title":"平均住院日",
				"render": function(obj, type, full) {
					var value = full.avgDays;
					var valuely = full.avgDaysly;
					return "<input id='"
							+ full.depGroupCode
							+ "_AvgDays' type='text' style='width:40px' value='"
							+ value + "'></input>"
							+ compareValueAvgDays(value, valuely);
				}
			},
			{
				"data" : "avgFee1",
				"title":"次均费用",
				"render": function(obj, type, full) {
					var value = full.avgFee;
					var valuely = full.avgFeely;
					return "<input id='" + full.depGroupCode
							+ "_AvgFee' type='text' style='width:60px' value='"
							+ full.avgFee + "'></input>"
							+ compareValue(value, valuely);
				}
			},
			{
				"data" : 'hcAvgFee1',
				"title":"医保次均费用",
				"render": function(obj, type, full) {
					var value = full.hcAvgFee;
					var valuely = full.hcAvgFeely;
					return "<input id='"
							+ full.depGroupCode
							+ "_HCAvgFee' type='text' style='width:60px' value='"
							+ full.hcAvgFee + "'></input>"
							+ compareValue(value, valuely);
				}
			},
			{
				"data" : "drugFee1",
				"title":"次均药费",
				"render": function(obj, type, full) {
					return "<input id='"
							+ full.depGroupCode
							+ "_DrugFee' type='text' style='width:80px' value='"
							+ full.drugFee + "'></input>";
				}
			},
			{
				"data" : "hcDrugFee1",
				"title":"医保次均药费",
				"render": function(obj, type, full) {
					return "<input id='"
							+ full.depGroupCode
							+ "_HCDrugFee' type='text' style='width:80px' value='"
							+ full.hcDrugFee + "'></input>";
				}
			},
			{
				"data" : 'totalCaseCnt1',
				"title":"入组病例数",
				"sType" : "numeric-input",
				"render": function(obj, type, full) {
					return "<input id='"
							+ full.depGroupCode
							+ "_TotalCaseCnt' type='text' style='width:50px' value='"
							+ full.totalCaseCnt + "'></input>";
				}
			},
			{
				"data" : "hcCaseCnt1",
				"title":"医保入组病例数",
				"render": function(obj, type, full) {
					return "<input id='"
							+ full.depGroupCode
							+ "_HCCaseCnt' type='text' style='width:50px' value='"
							+ full.hcCaseCnt + "'></input>";
				}
			},
			{
				"data" : "notHCRatio1",
				"title":"非医保患者比例（%）",
				"render": function(obj, type, full) {
					if (full.totalCaseCnt == 0) {
						return "<input id='"
								+ full.depGroupCode
								+ "_notHCRatio' type='text' style='width:50px' value='0'></input>";
					} else {
						var notHCRatio = (parseFloat(full.totalCaseCnt) - parseFloat(full.hcCaseCnt))
								/ parseFloat(full.totalCaseCnt) * 100;
						return "<input id='"
								+ full.depGroupCode
								+ "_notHCRatio' type='text' style='width:50px' value='"
								+ notHCRatio.toFixed(1) + "'></input>";

					}
				}
			},
			{
				"data" : "hcTotalFund1",
				"title":"医保总基金",
				"render": function(obj, type, full) {
					return "<input id='"
							+ full.depGroupCode
							+ "_HCTotalFund' type='text' style='width:80px' value='"
							+ full.hcTotalFund + "'></input>";
				}
			},
			{
				"data" : "timeEff1",
				"title":"时间消耗指数",
				"render": function(obj, type, full) {
					return "<input id='"
							+ full.depGroupCode
							+ "_TimeEff' type='text' style='width:80px' value='"
							+ full.timeEff + "'></input>";
				}
			},
			{
				"data" : "feeEff1",
				"title":"费用消耗指数",
				"render": function(obj, type, full) {
					return "<input id='" + full.depGroupCode
							+ "_FeeEff' type='text' style='width:80px' value='"
							+ full.feeEff + "'></input>";
				}
			},
			{
				"data" : "drugMateFee1",
				"title":"次均药耗费",
				"render": function(obj, type, full) {
					return "<input id='"
							+ full.depGroupCode
							+ "_DrugMateFee' type='text' style='width:80px' value='"
							+ full.drugMateFee + "'></input>";
				}
			},
			{
				"data" : "hcDrugMateFee1",
				"title":"医保次均药耗费",
				"render": function(obj, type, full) {
					return "<input id='"
							+ full.depGroupCode
							+ "_HCDrugMateFee' type='text' style='width:80px' value='"
							+ full.hcDrugMateFee + "'></input>";
				}
			} ];
	var paramDatatable = {
			lengthChange:false, 
			info:false, 
			searching:false,
			order:[[ 6, "desc" ]],
			paging:false,
			autoWidth : false,
			orderCellsTop : true,
			scrollX:true,
			scrollY:320
			}
	if(qouta_roles!="医保"){
		paramDatatable.columnDefs=[{
			 "visible": false,
			 "targets": [3,5,7,8,9,13]
	    }]
	}
	$("#"+tabId+" #resultDepGroup-table").dataTableBasic(columns, data, paramDatatable);
}

//清空全院数据
function emptyResultTableHosp(){
	emptyquotaCompare("AvgDays");
	emptyquotaCompare("AvgFee");
	emptyquotaCompare("HCAvgFee");
	emptyquotaCompare("DrugFee");
	emptyquotaCompare("HCDrugFee");
	emptyquotaCompare("TotalCaseCnt");
	emptyquotaCompare("HCCaseCnt");
	emptyquotaCompare("HCTotalFund");
	emptyquotaCompare("TimeEff");
	emptyquotaCompare("FeeEff");
	emptyquotaCompare("DrugMateFee");
	emptyquotaCompare("HCDrugMateFee");
}
//清空其他表格数据
function emptyResultTable(){
	emptyResultOtherTable("DepGroup");
	emptyResultOtherTable("DRGs");
	emptyResultOtherTable("ADRG");
	emptyResultOtherTable("MDC");
	emptyResultOtherTable("Dep");
}
    
//加载数据
function loadResultTableHosp(data){
	if(qouta_roles!="医保"){
		$("#"+tabId+" .hc").css("display","none");
		quotaCompare("AvgDays", data);
		quotaCompare("AvgFee", data);
		quotaCompare("DrugFee", data);
		quotaCompare("TotalCaseCnt", data);
		quotaCompare("TimeEff", data);
		quotaCompare("FeeEff", data);
		quotaCompare("DrugMateFee", data);
	}else{
		quotaCompare("AvgDays", data);
		quotaCompare("AvgFee", data);
		quotaCompare("HCAvgFee", data);
		quotaCompare("DrugFee", data);
		quotaCompare("HCDrugFee", data);
		quotaCompare("TotalCaseCnt", data);
		quotaCompare("HCCaseCnt", data);
		quotaCompare("HCTotalFund", data);
		quotaCompare("TimeEff", data);
		quotaCompare("FeeEff", data);
		quotaCompare("DrugMateFee", data);
		quotaCompare("HCDrugMateFee", data);
	}
}